package com.WebProject.service.AdminDao.impl;

import com.WebProject.mapper.AdminMapper;
import com.WebProject.mapper.AdminMapperImpl;
import com.WebProject.pojo.*;
import com.WebProject.service.AdminDao.AadminServiceDao;

import java.util.ArrayList;

/**
 * @PACKAGE_NAME: com.WebProject.service.AdminDao.impl
 * @NAME: AdminServiceDaoImpl
 * @USER: ZhouYongCheng
 * @DATE: 2022/7/29
 * @TIME: 17:18
 * @Description: AadminServiceDao实现类
 */

public class AdminServiceDaoImpl implements AadminServiceDao {

    private AdminMapper mapper = new AdminMapperImpl();
    /**
     * 查询指定类型车辆
     * @param car_number 车辆类型
     * @return 有该类型的车辆 反之
     */
    @Override
    public t_car queryAppointCarInfo(String car_number) {

        t_car car = this.mapper.queryAppointCarInfo(car_number);

        if (car != null){
            return car;
        }
        return null;
    }

    /**
     * 更改指定类型车辆信息
     * @param car 指定车辆信息Bean
     * @return true修改成功 反之
     */
    @Override
    public Boolean updateAppointCarInfo(t_car car) {

        return mapper.updateAppointCarInfo(car);
    }

    /**
     * 删除指定类型车辆
     * @param car_number 车牌
     * @return true删除成功 反之
     */
    @Override
    public Boolean deleteAppointCar(String car_number) {
        return mapper.deleteAppointCar(car_number);
    }

    /**
     * 查找指定用户的所有租借信息
     * @param user_id 用户id
     * @return null 没有该用户的租借信息
     */
    @Override
    public ArrayList<t_car_zu> queryAppointUserInfo(Integer user_id) {
        ArrayList<t_car_zu> t_car_zus = mapper.queryAppointUserInfo(user_id);
        if (t_car_zus !=null){
            return t_car_zus;
        }
        return null;
    }

    /**
     * 查找所有车辆
     * @return null为没有车辆
     */
    @Override
    public ArrayList<t_car_zu> queryAppointAllCarInfo() {
        ArrayList<t_car_zu> t_car_zus = mapper.queryAppointAllCarInfo();
        if (t_car_zus != null){
            return t_car_zus;
        }
        return null;
    }

    /**
     * 添加车辆
     * @param car 车辆Bean
     * @return false添加失败 反之
     */
    @Override
    public Boolean addCar(t_car car) {
        return mapper.addCar(car);
    }

    @Override
    public ArrayList<t_car> QueryAllCarInfo() {
        return mapper.QueryAllCarInfo();
    }

    @Override
    public ArrayList<t_brand> QueryAllBrandInfo() {
        return mapper.QueryAllBrandInfo();
    }

    @Override
    public ArrayList<t_category> QueryAllCategoryInfo() {
        return mapper.QueryAllCategoryInfo();
    }
}
